define(["uiComponent","dataServicesBase","jquery","Magento_Catalog/js/price-utils",],function(Component,ds,$,priceUnits){"use strict" return Component.extend({defaults:{template:"Magento_ProductRecommendationsLayout/recommendations.html",recs:[],},initialize:function(config){this._super(config) this.pagePlacement=config.pagePlacement this.placeholderUrl=config.placeholderUrl this.priceFormat=config.priceFormat this.priceUnits=priceUnits this.currencyConfiguration=config.currencyConfiguration this.alternateEnvironmentId=config.alternateEnvironmentId return this},initObservable:function(){return this._super().observe(["recs"])},processResponse(response){const units=[] if(!response.length||response[0].unitId===undefined){return units} for(let i=0;ia.displayOrder-b.displayOrder) return units},loadJsAfterKoRender:function(self,unit){const renderEvent=new CustomEvent("render",{detail:unit}) document.dispatchEvent(renderEvent)},convertPrice:function(price){return parseFloat(price*this.currencyConfiguration.rate)},createAddToCartUrl(productId){const currentLocationUENC=encodeURIComponent(this.encodeUenc(BASE_URL),) const postUrl=BASE_URL+"checkout/cart/add/uenc/"+ currentLocationUENC+"/product/"+ productId return postUrl},encodeUenc:function(value){const regex=/=/gi return btoa(value).replace(regex,",")},})})